import  axios from  'axios'

export default class FlowService {
    static flowService = null

    static getInstance(){
        if(this.flowService == null){
            this.flowService = new FlowService()
        }
        return this.flowService
    }

    FindAll(flow){
        return axios.get(`http://localhost/flows`,{
            params:flow
        })
    }

    getOne(ids){
        return axios.get(`http://localhost/flows/${ids}`)
    }

    save(vo){
        return axios.post(`http://localhost/flows`,vo)
    }

    qc(flowName){
        return axios.get(`http://localhost/flows/getOneByFlowName/${flowName}`)
    }

    del(flowId){
        return axios.delete(`http://localhost/flows/${flowId}`)
    }
    getUpdateJieDian(flowId){
        return axios.get(`http://localhost/flownodes/${flowId}`)
    }

    getUpdateauthority(moduleid){
        return axios.get(`http://localhost/authorities/${moduleid}`)
    }

    init(ids,moduleid){
        return axios.all([this.getOne(ids),this.getUpdateauthority(moduleid),this.getUpdateJieDian(ids)])
    }

}
